from selenium import webdriver
from selenium.webdriver.common.by import By
import time


class Email_163:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.driver.get('https://mail.163.com/')

    def login(self):
        website =self.driver.find_element(By.CSS_SELECTOR, 'iframe').get_attribute('id')
        log = self.driver.switch_to.frame(website)
        #定位账号输入框,输入密码
        self.driver.find_element(By.NAME,'email').send_keys('JH525855722')
        #定位密码输入框,输入密码
        self.driver.find_element(By.NAME,'password').send_keys('JH13277968935.')
        #定位登录按钮,点击登录
        self.driver.find_element(By.CSS_SELECTOR,'#dologin').click()
if __name__ == '__main__':
    email = Email_163()
    email.login()